﻿using System;
using System.Data;
using System.IO;
using System.Data.SqlClient;
using System.Web.UI.WebControls;
public partial class Main_Company_CompanyEdit : System.Web.UI.Page
{
    Datautility dut = new Datautility();
    string compid="";
    string username = string.Empty;

    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["userid"] == null)
        {
            Response.Redirect("~/SessionExpired.aspx");
        }       
        if (Session["username"].ToString() != string.Empty)
        {
            username = Session["username"].ToString();
        }
        if (CHKVat.Checked == false)
        {
            TxtBoxVat.Enabled = false;
            TxtBoxVat.Text = string.Empty;
            TxtVatDate.Text = string.Empty;
            TxtVatDate.Enabled = false;
        }
        else
        {
            TxtBoxVat.Enabled = true;
            TxtVatDate.Enabled = true;
        }
        if (CHKInterstate.Checked == false)
        {
            TextBoxinnerState.Enabled = false;
            TextBoxInterStateDate.Enabled = false;
            TextBoxinnerState.Text = string.Empty;
            TextBoxInterStateDate.Text = string.Empty;
        }
        else
        {
            TextBoxinnerState.Enabled = true;
            TextBoxInterStateDate.Enabled = true;
        }
        if (CHKServiceTax.Checked == false)
        {
            TextBoxServiceTax.Enabled = false;
            TxtDateServiceTax.Enabled = false;
            TxtDateServiceTax.Text = string.Empty;
            TextBoxServiceTax.Text = string.Empty;
        }
        else
        {
            TextBoxServiceTax.Enabled = true;
            TxtDateServiceTax.Enabled = true;
        }
        if (CHKCentralExcise.Checked == false)
        {
            TextBoxCentralExcise.Enabled = false;
            TxtDateCentralExcise.Enabled = false;
            TextBoxCentralExcise.Text = string.Empty;
            TxtDateCentralExcise.Text = string.Empty;
        }
        else
        {
            TextBoxCentralExcise.Enabled = true;
            TxtDateCentralExcise.Enabled = true;
        }
        if (CHKLuxuryTax.Checked == false)
        {
            TextBoxLuxuryTax.Enabled = false;
            TextBoxLuxuryTax.Text = String.Empty;
            DateLuxuryTax.Text = String.Empty;
            DateLuxuryTax.Enabled = false;
        }
        else
        {
            TextBoxLuxuryTax.Enabled = true;
            DateLuxuryTax.Enabled = true;
        }
        compid = dut.getdata("select compid from acc_company").Rows[0][0].ToString();
        if (!IsPostBack)
        {
            //To Set the start Date and End Date.
            //string tempyear = DateTime.Now.Year.ToString();
            //int tempendyear = Convert.ToInt32(tempyear) + 1;            
            //string startdate = "01/04/" + tempyear;
            //string enddate = "31/03/" + tempendyear;

            //CalExtAccountingYearStarting.StartDate = Convert.ToDateTime(startdate);
            //CalExtAccountingYearStarting.EndDate = Convert.ToDateTime(enddate);

            //CalExtAccountingLast.StartDate = Convert.ToDateTime(startdate);
            //CalExtAccountingLast.EndDate = Convert.ToDateTime(enddate);

            bindBType();    //Bind Bussiness type dropdown
            bindStatus();   //Bind Company status dropdown
            bindcountry();  //Bind Country dropdown
            bindstate();    //Bind State dropdown
            bindEditForm(compid); //Bind company details to the form
        }        
    }    
    protected void BtnUpdate_Click(object sender, EventArgs e)
    {
        UpdateCompanyInfo();
    }
    protected void ButtonUpdate_Click(object sender, EventArgs e)
    {
        UpdateCompanyInfo();         
    }
    protected void UpdateBtn_Click(object sender, EventArgs e) 
    {
        UpdateCompanyInfo();        
    }
    private void UpdateCompanyInfo()
    {
        UpdateCompanyMainInfo();
        UpdateCompanyContactInfo();
        UpdateCompanyRegDetails();
        lblMsg.Attributes.Remove("class");
        lblMsg.Attributes.Add("class", "true");
        lblMsg.Text = "Company information updated successfully...";
        DataTable dtcomp = dut.getdatausingprocedure("usp_get_acc_company_maintain_options");
        if (dtcomp.Rows.Count > 0)
        {
            Session["compname"] = dtcomp.Rows[0]["CompName"].ToString();
            Session["booksfromdate"] = dtcomp.Rows[0]["booksfromdate"].ToString();
            Session["IsInvrEnabled"] = dtcomp.Rows[0]["IsInvrEnabled"].ToString();
            Session["IsInvcEnabled"] = dtcomp.Rows[0]["IsInvcEnabled"].ToString();
            Session["IsAccEnabled"] = dtcomp.Rows[0]["IsAccEnabled"].ToString();
        }
        //Server.Transfer("../../Index.aspx");
        Response.Redirect("../../Welcome.aspx");        
    }
    protected void DDLTypeOfBuisness_SelectedIndexChanged(object sender, EventArgs e)
    {
        if (DDLTypeOfBuisness.SelectedValue == "0")
        {
            TxtOthers.Visible = true;
        }
        else
        {
            TxtOthers.Visible = false;
        }
    }
    protected void DDLStatus_SelectedIndexChanged(object sender, EventArgs e)
    {
        if (DDLStatus.SelectedValue == "0")
        {
            TxtStatus.Visible = true;
        }
        else
        {
            TxtStatus.Visible = false;
        }
    }
    protected void CHKVat_CheckChanged(object o, EventArgs e)
    {
        if (CHKVat.Checked)
        {
            TxtBoxVat.Enabled = true;
            TxtVatDate.Enabled = true;
        }
        else
        {
            TxtBoxVat.Enabled = false;
            TxtVatDate.Enabled = false;
        }
    }
    protected void CHKInterstate_CheckChanged(object o, EventArgs e)
    {
        if (CHKInterstate.Checked)
        {
            TextBoxinnerState.Enabled = true;
            TextBoxInterStateDate.Enabled = true;
        }
        else
        {
            TextBoxinnerState.Enabled = false;
            TextBoxInterStateDate.Enabled = false;
        }
    }
    protected void CHKServiceTax_CheckChanged(object o, EventArgs e)
    {
        if (CHKServiceTax.Checked)
        {
            TextBoxServiceTax.Enabled = true;
            TxtDateServiceTax.Enabled = true;
        }
        else
        {
            TextBoxServiceTax.Enabled = false;
            TxtDateServiceTax.Enabled = false;
        }
    }
    protected void CHKCentralExcise_CheckChanged(object o, EventArgs e)
    {
        if (CHKCentralExcise.Checked)
        {
            TextBoxCentralExcise.Enabled = true;
            TxtDateCentralExcise.Enabled = true;
        }
        else
        {
            TextBoxCentralExcise.Enabled = false;
            TxtDateCentralExcise.Enabled = false;
        }
    }
    protected void CHKLuxuryTax_CheckChanged(object o, EventArgs e)
    {
        if (CHKLuxuryTax.Checked)
        {
            TextBoxLuxuryTax.Enabled = true;
            DateLuxuryTax.Enabled = true;
        }
        else
        {
            TextBoxLuxuryTax.Enabled = false;
            DateLuxuryTax.Enabled = false;
        }
    }
    private void bindBType()
    {
        DataTable DT = dut.getdata("select BTypeId,BTypeName from ACC_BType");
        DDLTypeOfBuisness.DataSource = DT;
        DDLTypeOfBuisness.DataTextField = "BTypeName";
        DDLTypeOfBuisness.DataValueField = "BTypeId";
        DDLTypeOfBuisness.DataBind();
        ListItem lst = new ListItem("Others", "0");
        DDLTypeOfBuisness.Items.Add(lst);
    }
    private void bindStatus()
    {
        DataTable DT = dut.getdata("select CompStatusId,CompStatusName from ACC_CompStatus");
        DDLStatus.DataSource = DT;
        DDLStatus.DataTextField = "CompStatusName";
        DDLStatus.DataValueField = "CompStatusId";
        DDLStatus.DataBind();
        ListItem ls = new ListItem("Others", "0");
        DDLStatus.Items.Add(ls);
    }
    private void bindcountry()
    {
        DataTable dt = dut.getdata("select CountryId,CountryName from MAS_Country");
        DDLCountry.DataSource = dt;
        DDLCountry.DataTextField = "CountryName";
        DDLCountry.DataValueField = "CountryId";
        DDLCountry.DataBind();
    }
    private void bindstate()
    {
        DataTable DT = dut.getdata("select StateId,StateName from MAS_State");
        DDLState.DataSource = DT;
        DDLState.DataTextField = "StateName";
        DDLState.DataValueField = "StateId";
        DDLState.DataBind();
    }
    private void bindEditForm(string compid)
    {       
        DataTable DT = dut.getdata("select * from ACC_Company where compid="+compid);        
        if (DT.Rows.Count > 0)
        {
          TextCompanyName.Text = DT.Rows[0]["CompName"].ToString();
          TxtTradingName.Text = DT.Rows[0]["TradingName"].ToString();
          //txttinno.Text = DT.Rows[0]["TINNO"].ToString();
          Hidden.Value = DT.Rows[0]["LogoUrl"].ToString();
          if (DT.Rows[0]["LogoUrl"].ToString() != string.Empty)
          {
              Photo.ImageUrl = DT.Rows[0]["LogoUrl"].ToString();
          }
          else
          {              
              Photo.ImageUrl = "~/Images/blank.gif";
          }
          string selected_btype = DT.Rows[0]["BType"].ToString();
            DDLTypeOfBuisness.Items.FindByValue(selected_btype).Selected = true;
            if (selected_btype == "0")
            {
                TxtOthers.Visible = true;
                TxtOthers.Text = DT.Rows[0]["OthBtype"].ToString();
            }
            else
            {
                TxtOthers.Visible = false;
            }
            string selected_Status = DT.Rows[0]["StatusID"].ToString();
            DDLStatus.Items.FindByValue(selected_Status).Selected = true;
            if (selected_Status == "0")
            {              
                TxtStatus.Visible = true;
                TxtStatus.Text = DT.Rows[0]["OthStatus"].ToString();
            }
            else
            {
                TxtStatus.Visible = false;
            }
            string Accounting = DT.Rows[0]["IsAccEnabled"].ToString();
            if (Accounting == "True")
            {
                chk.Items[0].Selected = true;
            }            
            string Invoicing = DT.Rows[0]["IsInvcEnabled"].ToString();
            if (Invoicing == "True")
            {
                chk.Items[1].Selected = true;
            }           
            string Inventory = DT.Rows[0]["IsInvrEnabled"].ToString();
            if (Inventory == "True")
            {
                chk.Items[2].Selected = true;
            }           
            TxtAccountingYearStarting.Text = DT.Rows[0]["BooksfromDate"].ToString();
            TxtAccountingLast.Text = DT.Rows[0]["BooksEndDate"].ToString();
            TxtAdress1.Text = DT.Rows[0]["Add1"].ToString();
            TxtAddress2.Text = DT.Rows[0]["Add2"].ToString();
            TxtAddress3.Text = DT.Rows[0]["Add3"].ToString();
            TxtAddress4.Text = DT.Rows[0]["Add4"].ToString();
            TxtPlace.Text = DT.Rows[0]["place"].ToString();
            TxtPincode.Text = DT.Rows[0]["Pincode"].ToString();
            string selected_state = DT.Rows[0]["StateID"].ToString();
            //DDLState.Items.FindByValue(selected_state).Selected = true;
            DDLState.SelectedValue = selected_state;
            string selected_country = DT.Rows[0]["Country"].ToString();
            //DDLCountry.Items.FindByValue(selected_country).Selected = true;
            DDLCountry.SelectedValue = selected_country;
            TextBoxPhone.Text = DT.Rows[0]["Phone"].ToString();
            TextBoxFax.Text = DT.Rows[0]["Fax"].ToString();
            TextBoxEmail.Text = DT.Rows[0]["Email"].ToString();
            TextBoxWebsite.Text = DT.Rows[0]["Website"].ToString();
            TextBoxBuisnessActivity.Text = DT.Rows[0]["Activity"].ToString();
            TxtMiscellaneous1.Text = DT.Rows[0]["Misc1"].ToString();
            TxtMiscellaneous2.Text = DT.Rows[0]["Misc2"].ToString();
            TxtPermanant.Text = DT.Rows[0]["Pan"].ToString();
            if (DT.Rows[0]["PanDate"].ToString() != "")
            {
                if (Convert.ToDateTime(DT.Rows[0]["PanDate"].ToString()).ToShortDateString() != "01/01/1900")
                {
                    TxtDatePermanant.Text = DT.Rows[0]["PanDate"].ToString();
                }
            }            
            TxtTaxdeduction.Text = DT.Rows[0]["TDSNO"].ToString();
            if (DT.Rows[0]["TDSDate"].ToString() != "")
            {
                if (Convert.ToDateTime(DT.Rows[0]["TDSDate"].ToString()).ToShortDateString() != "01/01/1900")
                {
                    TxtdateTaxDeduction.Text = DT.Rows[0]["TDSDate"].ToString();
                }
            }
            string vatin = DT.Rows[0]["IsVatEnable"].ToString();
            if (vatin == "True")
            {
                CHKVat.Checked = true;
                TxtBoxVat.Enabled = true;
                TxtVatDate.Enabled = true;
            }
            TxtBoxVat.Text = DT.Rows[0]["VatNo"].ToString();
            if (DT.Rows[0]["VatDate"].ToString() != "")
            {
                if (Convert.ToDateTime(DT.Rows[0]["VatDate"].ToString()).ToShortDateString() != "01/01/1900")
                {
                    TxtVatDate.Text = DT.Rows[0]["VatDate"].ToString();
                }
            }
            string Interstate = DT.Rows[0]["IsCSTEnable"].ToString();
            if (Interstate == "True")
            {
                CHKInterstate.Checked = true;
                TextBoxinnerState.Enabled = true;
                TextBoxInterStateDate.Enabled = true;
            }
            TextBoxinnerState.Text = DT.Rows[0]["CSTNo"].ToString();
            if (DT.Rows[0]["CSTDate"].ToString() != "")
            {
                if (Convert.ToDateTime(DT.Rows[0]["CSTDate"].ToString()).ToShortDateString() != "01/01/1900")
                {
                    TextBoxInterStateDate.Text = DT.Rows[0]["CSTDate"].ToString();
                }
            }
            string servicetax = DT.Rows[0]["ISSTEnabled"].ToString();
            if (servicetax == "True")
            {
                CHKServiceTax.Checked = true;
                TextBoxServiceTax.Enabled = true;
                TxtDateServiceTax.Enabled = true;
            }
            TextBoxServiceTax.Text = DT.Rows[0]["SERTNo"].ToString();
            if (DT.Rows[0]["SERTNDate"].ToString() != "")
            {
                if (Convert.ToDateTime(DT.Rows[0]["SERTNDate"].ToString()).ToShortDateString() != "01/01/1900")
                {
                    TxtDateServiceTax.Text = DT.Rows[0]["SERTNDate"].ToString();
                }
            }           
            string centralexcise = DT.Rows[0]["ISCEEnabled"].ToString();
            if (centralexcise == "True")
            {
                CHKCentralExcise.Checked = true;
                TextBoxCentralExcise.Enabled = true;
                TxtDateCentralExcise.Enabled = true;
            }
            TextBoxCentralExcise.Text = DT.Rows[0]["CEPAN"].ToString();
            if (DT.Rows[0]["CEPANDate"].ToString() != "")
            {
                if (Convert.ToDateTime(DT.Rows[0]["CEPANDate"].ToString()).ToShortDateString() != "01/01/1900")
                {
                    TxtDateCentralExcise.Text = DT.Rows[0]["CEPANDate"].ToString();
                }
            }
            string Luxurytax = DT.Rows[0]["ISLTENABLED"].ToString();
            if (Luxurytax == "True")
            {
                CHKLuxuryTax.Checked = true;
                DateLuxuryTax.Enabled = true;
                TextBoxLuxuryTax.Enabled = true;
            }
            TextBoxLuxuryTax.Text = DT.Rows[0]["LTNO"].ToString();
            if (DT.Rows[0]["LTNDATE"].ToString() != "")
            {
                if (Convert.ToDateTime(DT.Rows[0]["LTNDATE"].ToString()).ToShortDateString() != "01/01/1900")
                {
                    DateLuxuryTax.Text = DT.Rows[0]["LTNDATE"].ToString();
                }
            }
            DT.Rows.Add();
        }         
   }
    protected void Button4_Click(object sender, EventArgs e)
    {
        Response.Redirect("../../Welcome.aspx");
    }
    protected void BtnCancel_Click(object sender, EventArgs e)
    {
        Response.Redirect("~/Welcome.aspx");
    }
    protected void Button2_Click(object sender, EventArgs e)
    {
        Response.Redirect("~/Welcome.aspx");
    }
    private void UpdateCompanyMainInfo()
    {
        int account = 0, invoice = 0, inventory = 0;
        //int selected = Convert.ToInt16(chk.SelectedValue);
        //lblMsg.Text = selected.ToString();
        if (chk.Items[0].Selected)
        {
            account = 1;
        }

        if (chk.Items[1].Selected)
        {
            invoice = 1;
        }

        if (chk.Items[2].Selected)
        {
            inventory = 1;
        }

        string[] arrstartdate = TxtAccountingYearStarting.Text.Split(new char[] { '/' });
        string startdate = arrstartdate[1].ToString() + "/" + arrstartdate[0].ToString() + "/" + arrstartdate[2].ToString();

        string[] arrenddate = TxtAccountingLast.Text.Split(new char[] { '/' });
        string enddate = arrenddate[1].ToString() + "/" + arrenddate[0].ToString() + "/" + arrenddate[2].ToString();

        //*****Commented by Vikram on 21-10-10, as the company code and name need to be different ****//
        //DataSet ds =new DataSet();
        //ds.ReadXml(Server.MapPath("~/App_Data/ConnStr.xml"));
        //if (ds.Tables.Count > 0)
        //{
        //    DataTable dt=ds.Tables[0];
        //    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
        //    {
        //        if (dt.Rows[i]["companyname"].ToString().Equals(Session["compname"].ToString(),StringComparison.OrdinalIgnoreCase))
        //        {
        //            dt.Rows[i]["companyname"] = TextCompanyName.Text;
        //            ds.WriteXml(Server.MapPath("~/App_Data/ConnStr.xml"));
        //            break;
        //        }
        //    }
        //}
        string path = "";
        string oldfilepath = Hidden.Value;
        if (Fld.HasFile)
        {
            string randomnumber = RandomNameGenerator.getRandomName();
            FileInfo file = new FileInfo(Fld.PostedFile.FileName);
            string ext = file.Extension;
            path = "~/Main/Company/Logo/" + randomnumber + ext;
            Fld.SaveAs(Server.MapPath(path));
            //if (oldfilepath != string.Empty)
            //{
            //    File.Delete(Server.MapPath(oldfilepath));
            //}
        }
        else
        {
            path = oldfilepath;
        }
        SqlParameter[] parm ={
                                  new SqlParameter("@CompId",compid),
                                  new SqlParameter("@CompName", TextCompanyName.Text.Trim()),
                                  new SqlParameter("@TradingName", TxtTradingName.Text.Trim()),
                                  new SqlParameter("@LogoUrl", path.ToString()),
                                  new SqlParameter("@BType", DDLTypeOfBuisness.SelectedValue),
                                  new SqlParameter("@OthBtype",TxtOthers.Text.Trim()),
                                  new SqlParameter("@StatusID",DDLStatus.SelectedValue),
                                  new SqlParameter("@OthStatus",TxtStatus.Text.Trim()),
                                  new SqlParameter("@IsAccEnabled",account),
                                  new SqlParameter("@IsInvcEnabled",invoice),
                                  new SqlParameter("@IsInvrEnabled",inventory),
                                  new SqlParameter("@BooksFromDate",startdate),
                                  new SqlParameter("@BooksEndDate",enddate),
                                  new SqlParameter("@WorkingDate",Session["CURRENTDATE"].ToString()),
                                  new SqlParameter("@EName",username)                                  
                               };
        dut.executeprocedure("usp_update_ACC_Company1", parm);
        //RegisterClientScriptBlock("abc", "<script language='javascript'>parent.frames['SideMenu1'].location.reload();</script>");
    }
    private void UpdateCompanyContactInfo()
    {
        SqlParameter[] parm = {
                                  new SqlParameter("@CompId",compid),
                                   new SqlParameter("@Add1", TxtAdress1.Text.Trim()),
                                   new SqlParameter("@Add2", TxtAddress2.Text.Trim()),
                                   new SqlParameter("@Add3", TxtAddress3.Text.Trim()),
                                   new SqlParameter("@Add4", TxtAddress4.Text.Trim()),
                                   new SqlParameter("@Pincode", TxtPincode.Text.Trim()),
                                   new SqlParameter("@Country", DDLCountry.SelectedValue),
                                   new SqlParameter("@place", TxtPlace.Text.Trim()),
                                   new SqlParameter("@StateID", DDLState.SelectedValue),
                                   new SqlParameter("@Phone", TextBoxPhone.Text.Trim()),
                                   new SqlParameter("@Fax", TextBoxFax.Text.Trim()),
                                   new SqlParameter("@Email",TextBoxEmail.Text.Trim()),
                                   new SqlParameter("@WebSite", TextBoxWebsite.Text.Trim()),
                                   new SqlParameter("@Activity", TextBoxBuisnessActivity.Text.Trim()),
                                   new SqlParameter("@Misc1", TxtMiscellaneous1.Text.Trim()),
                                   new SqlParameter("@Misc2", TxtMiscellaneous2.Text.Trim())                                   
                               };
        dut.executeprocedure("usp_update_ACC_Company2", parm);
      }
    private void UpdateCompanyRegDetails()
    {
        string Pan = "", taxdeduct = "", vat = "", StateTax = "", TaxService = "", centralexcise = "", luxury = "";
        if (TxtDatePermanant.Text.Trim() != "")
        {
            string[] PanDate = TxtDatePermanant.Text.Split(new char[] { '/' });
            Pan = PanDate[1].ToString() + "/" + PanDate[0].ToString() + "/" + PanDate[2].ToString();
        }
        if (TxtdateTaxDeduction.Text.Trim() != "")
        {
            string[] dateDedcutionTax = TxtdateTaxDeduction.Text.Split(new char[] { '/' });
            taxdeduct = dateDedcutionTax[1].ToString() + "/" + dateDedcutionTax[0].ToString() + "/" + dateDedcutionTax[2].ToString();
        }
        if (TxtVatDate.Text.Trim() != "")
        {
            string[] dateVat = TxtVatDate.Text.Split(new char[] { '/' });
            vat = dateVat[1].ToString() + "/" + dateVat[0].ToString() + "/" + dateVat[2].ToString();
        }
        if (TextBoxInterStateDate.Text.Trim() != "")
        {
            string[] dateInterState = TextBoxInterStateDate.Text.Split(new char[] { '/' });
            StateTax = dateInterState[1].ToString() + "/" + dateInterState[0].ToString() + "/" + dateInterState[2].ToString();
        }
        if (TxtDateServiceTax.Text.Trim() != "")
        {
            string[] dateServiceTax = TxtDateServiceTax.Text.Split(new char[] { '/' });
            TaxService = dateServiceTax[1].ToString() + "/" + dateServiceTax[0].ToString() + "/" + dateServiceTax[2].ToString();
        }
        if (TxtDateCentralExcise.Text.Trim() != "")
        {
            string[] CentralExciseDate = TxtDateCentralExcise.Text.Split(new char[] { '/' });
            centralexcise = CentralExciseDate[1].ToString() + "/" + CentralExciseDate[0].ToString() + "/" + CentralExciseDate[2].ToString();
        }
        if (DateLuxuryTax.Text.Trim() != "")
        {
            string[] datetaxluxury = DateLuxuryTax.Text.Split(new char[] { '/' });
            luxury = datetaxluxury[1].ToString() + "/" + datetaxluxury[0].ToString() + "/" + datetaxluxury[2].ToString();
        }
        int isvat = 0, iscst = 0, issst = 0, isce = 0, islt = 0;
        if (CHKVat.Checked == true)
        {
            isvat = 1;
        }
        if (CHKInterstate.Checked == true)
        {
            iscst = 1;
        }
        if (CHKServiceTax.Checked == true)
        {
            issst = 1;
        }
        if (CHKCentralExcise.Checked == true)
        {
            isce = 1;
        }
        if (CHKLuxuryTax.Checked == true)
        {
            islt = 1;
        }
        SqlParameter[] parm = {
                                    new SqlParameter("@CompId",compid),
                                    new SqlParameter("@Pan", TxtPermanant.Text.Trim()),
                                    new SqlParameter("@PanDate", Pan),
                                    new SqlParameter("@TDSNO", TxtTaxdeduction.Text.Trim()),
                                    new SqlParameter("@TDSDate", taxdeduct),
                                    new SqlParameter("@IsVatEnable",isvat),
                                    new SqlParameter("@VatNo",TxtBoxVat.Text.Trim()),
                                    new SqlParameter("@VatDate", vat  ),
                                    new SqlParameter("@IsCSTEnable",iscst),
                                    new SqlParameter("@CSTNo",TextBoxinnerState.Text.ToString()),
                                    new SqlParameter("@CSTDate",StateTax),
                                    new SqlParameter("@ISSTEnabled",issst),
                                    new SqlParameter("@SERTNo",TextBoxServiceTax.Text.Trim()),
                                    new SqlParameter("@SERTNDate",TaxService),
                                    new SqlParameter("@ISCEEnabled",isce),
                                    new SqlParameter("@CEPAN",TextBoxCentralExcise.Text.Trim()),
                                    new SqlParameter("@CEPANDate",centralexcise),
                                    new SqlParameter("@ISLTENABLED",islt),
                                    new SqlParameter("@LTNO", TextBoxLuxuryTax.Text.ToString()),
                                    new SqlParameter("@LTNDATE",luxury), 
                                    new SqlParameter("@CINNO",txtcinno.Text)
                                };
        dut.executeprocedure("usp_update_ACC_Company3", parm);      
    }
}
